import 'package:fluro/fluro.dart';
import 'package:flutter_study/widgets/animated_builder2_page.dart';
import 'package:flutter_study/widgets/animated_builder3_page.dart';
import 'package:flutter_study/widgets/animated_builder_page.dart';
import 'package:flutter_study/widgets/animatedcontainer_study_page.dart';
import 'package:flutter_study/widgets/custom_multi_child_page.dart';
import 'package:flutter_study/widgets/custom_paint_page.dart';
import 'package:flutter_study/widgets/flex_study_page.dart';
import 'package:flutter_study/widgets/inheritedwidget_study_page.dart';
import 'package:flutter_study/widgets/renderbox_study_page.dart';
import 'package:flutter_study/widgets/safearea_study_page.dart';

import 'router_init.dart';

class StudyRouter implements IRouterProvider {
  // details
  static const WIDGET_SAFE_AREA = '/SafeArea';
  static const WIDGET_FLEX = '/Flex';
  static const WIDGET_PROVIDER = '/provider';
  static const WIDGET_ANIMATED_CONTAINER = '/AnimatedContainer';
  static const WIDGET_ANIMATED_BUILDER = '/AnimatedBuilder';
  static const WIDGET_ANIMATED_BUILDER_2 = '/AnimatedBuilder2';
  static const WIDGET_ANIMATED_BUILDER_3 = '/AnimatedBuilder3';
  static const WIDGET_CUSTOM_PAINT = '/CustomPaint';
  static const WIDGET_CUSTOM_MULTI_CHILD = '/CustomMultiChild';
  static const WIDGET_RENDER_BOX_STUDY = '/RenderBoxStudy';

  @override
  void initRouter(FluroRouter router) {
    router.define(WIDGET_SAFE_AREA,
        handler:
            Handler(handlerFunc: (context, params) => SafeAreaStudyPage()));
    router.define(WIDGET_FLEX,
        handler: Handler(handlerFunc: (context, params) => FlexStudyPage()));
    router.define(WIDGET_ANIMATED_CONTAINER,
        handler: Handler(
            handlerFunc: (context, params) => AnimatedContainerStudyPage()));
    router.define(WIDGET_PROVIDER,
        handler: Handler(
            handlerFunc: (context, params) => InheritedWidgetStudyPage()));
    router.define(WIDGET_ANIMATED_BUILDER,
        handler:
            Handler(handlerFunc: (context, params) => AnimatedBuilderStudy()));
    router.define(WIDGET_ANIMATED_BUILDER_2,
        handler:
            Handler(handlerFunc: (context, params) => AnimatedBuilder2Study()));
    router.define(WIDGET_ANIMATED_BUILDER_3,
        handler:
            Handler(handlerFunc: (context, params) => AnimatedBuilder3Study()));
    router.define(WIDGET_CUSTOM_PAINT,
        handler: Handler(handlerFunc: (context, params) => CustomPaintPage()));
    router.define(WIDGET_CUSTOM_MULTI_CHILD,
        handler: Handler(handlerFunc: (context, params) => CustomMultiChildPage()));
    router.define(WIDGET_RENDER_BOX_STUDY,
        handler: Handler(handlerFunc: (context, params) => RenderBoxStudyPage()));
  }

  static String getNameByPos(int index) {
    String pathName = "";
    switch (index) {
      case 0:
        pathName = StudyRouter.WIDGET_SAFE_AREA;
        break;
      case 1:
        pathName = StudyRouter.WIDGET_FLEX;
        break;
      case 2:
        pathName = StudyRouter.WIDGET_ANIMATED_CONTAINER;
        break;
      case 3:
        pathName = StudyRouter.WIDGET_PROVIDER;
        break;
      case 4:
        pathName = StudyRouter.WIDGET_ANIMATED_BUILDER;
        break;
      case 5:
        pathName = StudyRouter.WIDGET_ANIMATED_BUILDER_2;
        break;
      case 6:
        pathName = StudyRouter.WIDGET_ANIMATED_BUILDER_3;
        break;
      case 7:
        pathName = StudyRouter.WIDGET_CUSTOM_PAINT;
        break;
      case 8:
        pathName = StudyRouter.WIDGET_CUSTOM_MULTI_CHILD;
        break;
        case 9:
        pathName = StudyRouter.WIDGET_RENDER_BOX_STUDY;
        break;
      default:
        break;
    }
    return pathName;
  }
}
